<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: I:/Sources/sdlgfx/SDL_framerate.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">SDL_gfx
   &#160;<span id="projectnumber">2.0.25</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">I:/Sources/sdlgfx/SDL_framerate.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_s_d_l__framerate_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">SDL_framerate.h: framerate manager</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012  Andreas Schiffler</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">This software is provided &#39;as-is&#39;, without any express or implied</span>
<a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span>
<a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span>
<a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span>
<a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span>
<a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span>
<a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span>
<a name="l00019"></a>00019 <span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span>
<a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span>
<a name="l00022"></a>00022 <span class="comment"></span>
<a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span>
<a name="l00024"></a>00024 <span class="comment">distribution.</span>
<a name="l00025"></a>00025 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span>
<a name="l00027"></a>00027 <span class="comment"></span>
<a name="l00028"></a>00028 <span class="comment">*/</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL_framerate_h</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_framerate_h</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="comment">/* Set up for C function definitions, even when using C++ */</span>
<a name="l00034"></a>00034 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00036"></a>00036 <span class="preprocessor">#endif</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038         <span class="comment">/* --- */</span>
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;SDL.h&quot;</span>
<a name="l00041"></a>00041 
<a name="l00042"></a>00042         <span class="comment">/* --------- Definitions */</span>
<a name="l00043"></a>00043 
<a name="l00047"></a><a class="code" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">00047</a> <span class="preprocessor">#define FPS_UPPER_LIMIT         200</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00052"></a><a class="code" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">00052</a> <span class="preprocessor">#define FPS_LOWER_LIMIT         1</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span>
<a name="l00057"></a><a class="code" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">00057</a> <span class="preprocessor">#define FPS_DEFAULT             30</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span>
<a name="l00062"></a><a class="code" href="struct_f_p_smanager.html">00062</a>         <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00063"></a><a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">00063</a>                 Uint32 <a class="code" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a>;
<a name="l00064"></a><a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">00064</a>                 <span class="keywordtype">float</span> <a class="code" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a>;
<a name="l00065"></a><a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">00065</a>                 Uint32 <a class="code" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a>;
<a name="l00066"></a><a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">00066</a>                 Uint32 <a class="code" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a>;
<a name="l00067"></a><a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">00067</a>                 Uint32 <a class="code" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a>;
<a name="l00068"></a>00068         } <a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a>;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070         <span class="comment">/* ---- Function Prototypes */</span>
<a name="l00071"></a>00071 
<a name="l00072"></a>00072 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#  if defined(DLL_EXPORT) &amp;&amp; !defined(LIBSDL_GFX_DLL_IMPORT)</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#    define SDL_FRAMERATE_SCOPE __declspec(dllexport)</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#  else</span>
<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#    ifdef LIBSDL_GFX_DLL_IMPORT</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#      define SDL_FRAMERATE_SCOPE __declspec(dllimport)</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#    endif</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#  endif</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_FRAMERATE_SCOPE</span>
<a name="l00082"></a><a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">00082</a> <span class="preprocessor"></span><span class="preprocessor">#  define SDL_FRAMERATE_SCOPE extern</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span>
<a name="l00085"></a>00085         <span class="comment">/* Functions return 0 or value for sucess and -1 for error */</span>
<a name="l00086"></a>00086 
<a name="l00087"></a>00087         <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44" title="Initialize the framerate manager.">SDL_initFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager);
<a name="l00088"></a>00088         <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#afad4b503cf9719daced45fa4d9653d72" title="Set the framerate in Hz.">SDL_setFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager, Uint32 rate);
<a name="l00089"></a>00089         <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91" title="Return the current target framerate in Hz.">SDL_getFramerate</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager);
<a name="l00090"></a>00090         <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec" title="Return the current framecount.">SDL_getFramecount</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager);
<a name="l00091"></a>00091         <a class="code" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_FRAMERATE_SCOPE</a> Uint32 <a class="code" href="_s_d_l__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba" title="Delay execution to maintain a constant framerate and calculate fps.">SDL_framerateDelay</a>(<a class="code" href="struct_f_p_smanager.html" title="Structure holding the state and timing information of the framerate controller.">FPSmanager</a> * manager);
<a name="l00092"></a>00092 
<a name="l00093"></a>00093         <span class="comment">/* --- */</span>
<a name="l00094"></a>00094 
<a name="l00095"></a>00095         <span class="comment">/* Ends C function definitions when using C++ */</span>
<a name="l00096"></a>00096 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span>}
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span>
<a name="l00100"></a>00100 <span class="preprocessor">#endif                          </span><span class="comment">/* _SDL_framerate_h */</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
